MAIN_OBJ	= Main.o compress_gpu.o util.o
DECOMPRESS_OBJ  = decompressOutput.o findMisMatch_gpu.o util.o compress_gpu.o compress_cpu.o compressTitle_cpu.o
CUDA_HOME       = /home/yuwei/NVIDIA_GPU_Computing_SDK
NVCC_HOME	= /usr/local/cuda
CC              = g++
NVCC            = nvcc 
INCLUDE         = -I./cpp -I$(NVCC_HOME)/include -I$(CUDA_HOME)/C/common/inc 
LIB             = -L/usr/local/lib -L$(NVCC_HOME)/lib64 -L$(CUDA_HOME)/C/lib -lcutil_x86_64 -lcuda -lcudart -lpthread
CFLAGS          = -O3
NVCCFLAGS       = -O3 -arch=sm_20 --ptxas-options=-v


test: $(MAIN_OBJ)
	$(CC) -o test $(MAIN_OBJ) $(CFLAGS) $(INCLUDE) $(LIB)
Main.o: Main.cpp
	$(CC) -c Main.cpp $(CFLAGS) $(INCLUDE)
compress_gpu.o: ../CompressAlign/cpp/compress_gpu.cu
	$(NVCC) -c ../CompressAlign/cpp/compress_gpu.cu $(CFLAGS) $(INCLUDE)
compress_cpu.o: ../CompressAlign/cpp/compress_cpu.cpp
	$(CC) -c ../CompressAlign/cpp/compress_cpu.cpp $(CFLAGS) $(INCLUDE)
compressTitle_cpu.o: ../CompressAlign/cpp/compressTitle_cpu.cpp
	$(CC) -c ../CompressAlign/cpp/compressTitle_cpu.cpp $(CFLAGS) $(INCLUDE)
util.o: util.cu
	$(NVCC) -c util.cu $(CFLAGS) $(INCLUDE)
decompression: $(DECOMPRESS_OBJ)
	$(CC) -o decompression $(DECOMPRESS_OBJ) $(CFLAGS) $(INCLUDE) $(LIB)
findMisMatch_gpu.o: findMisMatch_gpu.cu
	$(NVCC) -c findMisMatch_gpu.cu $(NVCCFLAGS) $(INCLUDE)
decompressOutput.o: decompressOutput.cpp
	$(CC) -c decompressOutput.cpp $(CFLAGS) $(INCLUDE)

all: test decompression

clean:
	rm -f *.o test decompression builder
